package com.ruoyi.novel.service.impl;

import java.util.List;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.ruoyi.common.utils.DateUtils;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.novel.mapper.CommunityMapper;
import com.ruoyi.novel.domain.Community;
import com.ruoyi.novel.service.ICommunityService;

/**
 * 社区信息Service业务层处理
 *
 * @author 张三
 * @date 2025-04-18
 */
@Service
public class CommunityServiceImpl extends ServiceImpl<CommunityMapper, Community> implements ICommunityService
{
    @Autowired
    private CommunityMapper communityMapper;

    /**
     * 查询社区信息
     *
     * @param id 社区信息主键
     * @return 社区信息
     */
    @Override
    public Community selectCommunityById(Integer id)
    {
        return communityMapper.selectCommunityById(id);
    }

    /**
     * 查询社区信息列表
     *
     * @param community 社区信息
     * @return 社区信息
     */
    @Override
    public List<Community> selectCommunityList(Community community)
    {
        return communityMapper.selectCommunityList(community);
    }

    /**
     * 新增社区信息
     *
     * @param community 社区信息
     * @return 结果
     */
    @Override
    public int insertCommunity(Community community)
    {
        community.setCreateTime(DateUtils.getNowDate());
        return communityMapper.insertCommunity(community);
    }

    /**
     * 修改社区信息
     *
     * @param community 社区信息
     * @return 结果
     */
    @Override
    public int updateCommunity(Community community)
    {
        community.setUpdateTime(DateUtils.getNowDate());
        return communityMapper.updateCommunity(community);
    }

    /**
     * 批量删除社区信息
     *
     * @param ids 需要删除的社区信息主键
     * @return 结果
     */
    @Override
    public int deleteCommunityByIds(Integer[] ids)
    {
        return communityMapper.deleteCommunityByIds(ids);
    }

    /**
     * 删除社区信息信息
     *
     * @param id 社区信息主键
     * @return 结果
     */
    @Override
    public int deleteCommunityById(Integer id)
    {
        return communityMapper.deleteCommunityById(id);
    }

    @Override
    public IPage<Community> getCommunityList(IPage<Community> page, QueryWrapper<Community> queryWrapper, Integer userId) {
        return communityMapper.getCommunityList(page, queryWrapper, userId);
    }

    @Override
    public List<Community> getCommunityById(QueryWrapper<Community> queryWrapper, Integer userId) {
        return communityMapper.getCommunityById(queryWrapper, userId);
    }

    @Override
    public IPage<Community> getUserCommunityList(IPage<Community> page, QueryWrapper<Community> queryWrapper) {
        return communityMapper.getUserCommunityList(page, queryWrapper);
    }

    @Override
    public IPage<Community> getOrderCommunityList(IPage<Community> page, QueryWrapper<Community> queryWrapper) {
        return communityMapper.getOrderCommunityList(page, queryWrapper);
    }
}
